// ----------------------------------------------------------------------------
// serialize_scalar_type.cpp
// ----------------------------------------------------------------------------
#include <fw/base/serialize/serialize_scalar_type.h>
#include <fw/base/core/assertion.h>

namespace fw
{
	SerializeScalarType::~SerializeScalarType()
	{
	}
	
	SerializeStatus SerializeScalarType::ConvertOne(char*					dstData,
													const char*				srcData,
													const SerializeType*	srcType,
													SerializeAllocator&		allocator,
													int						arrayCount) const
	{
		FW_ASSERT(srcType);
		const SerializeScalarType*	srcScalarType   = srcType->AsScalarType();
		FW_ASSERT(srcScalarType);
		SerializeScalarValue		srcValue		= srcScalarType->ReadScalarValue(srcData);
		if(dstData)
		{
			WriteScalarValue(dstData, srcValue);
		}
		return kStatus_Ok;
	}
	
	bool SerializeScalarType::IsTerminal(const char*					data,
										  const SerializeScalarValue&	terminatorValue,
										  Hash							terminatorName) const
	{
		return (ReadScalarValue(data) == terminatorValue) ? true : false;
	}
	
	SerializeStatus SerializeScalarType::FixUp(SerializeSchema& schema)
	{
		return kStatus_Ok;
	}
	
} // namespace fw
